import "./index.scss"
import {Button, Col,Form, Input, Row, Select} from 'antd';
import React from 'react';
import store from "../../../store";
import {observer} from "mobx-react-lite";

const MemberQuery = () => {
    const { Option } = Select;

    const [form] = Form.useForm();
    //提交
    const submit = () => {
        store.memberShip.resetlist()
        const a= form.getFieldsValue(true)
        console.log("222",a) /*查询表单数据*/
        let chaxun={}
        let aaa=[]
        for(let key in a ){
            if(a[key]!="全部" && a[key]!=""){
                chaxun[key]=a[key].trim()
            }
        }
        console.log(chaxun)
        // console.log()
       if(JSON.stringify(chaxun)!="{}"){
           console.log(111)
           store.memberShip.memberTableList.forEach((v,i)=>{
               for(let key in v){
                   if(v[key].indexOf(chaxun[key])!=-1 && aaa.indexOf(v)===-1){
                       aaa.push(v)
                   }
               }
           })
           console.log('aaa',aaa)
           store.memberShip.setMemberTableList(aaa)
       }

    };
    //重置
    const onReset = () => {
        form.resetFields();
    };

    return (
        <div id={"content_query"}>
            <Row justify={"end"}>
                <Col pull={1}>
                    <Button type="link" onClick={onReset}>重置</Button>
                </Col>
                <Col pull={1}>
                    <Button type="primary" onClick={submit}>查询</Button>
                </Col>
            </Row>
            <Form
                form = { form }
                name="basic"
                autoComplete="off"
                labelCol={{span:6}}
                className={"form"}
                initialValues={{
                    status: '全部',
                    belong: '全部'
                }}
            >
                <Form.Item
                    label="手机号"
                    name="telnumber"
                    className={"formItem"}
                >
                    <Input/>
                </Form.Item>
                <Form.Item
                    label="会员标签"
                    name="MemberLabel"
                    className={"formItem"}
                >
                    <Input/>
                </Form.Item>
                {/*<Form.Item*/}
                {/*    label="SN码"*/}
                {/*    name="snlabel"*/}
                {/*    className={"formItem"}*/}
                {/*>*/}
                {/*    <Input/>*/}
                {/*</Form.Item>*/}
                <Form.Item
                    label="加盟商"
                    name="Franchisee"
                    className={"formItem"}
                >
                    <Select
                        allowClear
                    >
                        <Option value="全部">全部</Option>
                        <Option value='西湖黄龙店'>西湖黄龙店</Option>
                        <Option value='西湖西溪店'>西湖西溪店</Option>
                        <Option value='西湖古墩店'>西湖古墩店</Option>
                        <Option value='西湖湖畔店'>西湖湖畔店</Option>
                        <Option value='西湖武林店'>西湖武林店</Option>
                    </Select>
                </Form.Item>

                <Form.Item
                    label="状态"
                    name="state"
                    className={"formItem"}
                >
                    <Select
                        allowClear
                    >
                        <Option value="全部">全部</Option>
                        <Option value="正常">正常</Option>
                        <Option value="冻结">冻结</Option>
                    </Select>
                </Form.Item>
                {/*<Form.Item*/}
                {/*    label="消费对象"*/}
                {/*    name="objxiaofei"*/}
                {/*    className={"formItem"}*/}
                {/*>*/}
                {/*    <Select*/}
                {/*        allowClear*/}
                {/*    >*/}
                {/*        <Option value="全部">全部</Option>*/}
                {/*        <Option value='小黑早教'>小黑早教</Option>*/}
                {/*        <Option value='小黑绘本'>小黑绘本</Option>*/}
                {/*        <Option value='积分商城'>积分商城</Option>*/}
                {/*    </Select>*/}
                {/*</Form.Item>*/}
                <Form.Item
                    label="注册来源"
                    name="SourceOfRegistration"
                    className={"formItem"}
                >
                    <Select
                        allowClear
                    >
                        <Option value="全部">全部</Option>
                        <Option value="小黑早教">小黑早教</Option>
                        <Option value="小黑绘本">小黑绘本</Option>
                        <Option value="萌萌乐卡通">萌萌乐卡通</Option>
                        <Option value="萌萌儿歌">萌萌儿歌</Option>
                    </Select>
                </Form.Item>

            {/*/!*    注册时间*!/*/}
            {/*    <Form.Item*/}
            {/*        label="注册时间"*/}
            {/*        name="RegistrationTime"*/}
            {/*        className={"formItem"}*/}
            {/*    >*/}
            {/*        <DatePicker className={"inpt"} defaultValue={moment('2022/10/17', startdateFormat)} format={startdateFormat} />*/}
            {/*        <span className={"inptspan"}> - </span>*/}
            {/*        <DatePicker className={"inpt"} defaultValue={moment('2022/10/17', enddateFormat)} format={enddateFormat} />*/}
            {/*    </Form.Item>*/}
            {/*/!*    消费金额*!/*/}
            {/*    <Form.Item*/}
            {/*        label="消费金额"*/}
            {/*        name="ConsumptionAmount"*/}
            {/*        className={"formItem"}*/}
            {/*    >*/}
            {/*        <Input className={"inpt"}  placeholder='最小金额' />*/}
            {/*        <span className={"inptspan"}> - </span>*/}
            {/*        <Input className={"inpt"}  placeholder='最大金额' />*/}
            {/*    </Form.Item>*/}



            </Form>
        </div>
    );

}
export default observer(MemberQuery)


